#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <string>
using namespace std;


unordered_map<string, int>h;

//排序
bool cmp(string a,string b)
{
   return h[a] < h[b];
}


void find(string s)
{
   vector<string>ans; //储存结果

   //判断是否完全匹配
   if (h[s])
   {
       cout << s << " is correct";
       return;
   }
   //第一类：匹配在任意插入一个‘a-'z'字符的近似项 注意小于等于
   {
   for (int i = 0; i <= s.size(); i++) 
       for (int j = 0; j < 26; j++)
       {
           string t1 = s.substr(0, i) + (char)('a' + j) + s.substr(i);
           if (h[t1]) ans.push_back(t1);
       }
   }

   // 第二类：匹配删除任一字符的相似项
   for (int i = 0; i < s.size(); i++) 
   {
       string t2 = s.substr(0, i) + s.substr(i + 1);
       if (h[t2]) ans.push_back(t2);
   }
   for (int i = 0; i < s.size(); i++) //第三类匹配 - 取代任一字符
   {
       string t3 = s;
       for (int j = 0; j < 26; j++)
       {
           t3[i] = char('a' + j);
           if (h[t3]) ans.push_back(t3);
       }
   }


   sort(ans.begin(), ans.end(),cmp);//排序，按照输入顺序输出
   ans.erase(unique(ans.begin(), ans.end()), ans.end());//去重,除去重复元素
 
   cout << s << ":";
   for (auto e : ans)
   {
       cout << " " << e;
   }
}

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
   string s;
   int cnt = 0;
   while (1)//输入到单词库中的单词数目
   {
       cin >> s;
       if (s == "#") break;
       h[s] = ++cnt;
   }
 
   while (1)
   {
       cin >> s;
       if (s == "#") break;
       find(s);
       cout << "\n";

   }


   return 0;
}



//数据测试：
//i
//is
//has
//have
//be
//my
//more
//contest
//me
//too
//if
//award
//#
//me
//aware
//m
//contest
//hav
//oo
//or
//i
//fi
//mre
//#


//结果：
//me is correct
//aware : award
//m : i my me
//contest is correct
//hav : has have
//oo : too
//or :
//i is correct
//fi : i
//mre : more me